package threadDemo1.parameter;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-27
 * Time: 02:28
 */
public class ThreadDemo {
    public static boolean isQuit = false;
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            while (!isQuit){
                System.out.println("Hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("Over Thread");
        });
        thread.start();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        isQuit = true;
    }
}
